﻿using Petroleum.DB.Model;
using SQLite.CodeFirst;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Petroleum.DB
{
    public class SqliteDbContext : DbContext
    {
        public SqliteDbContext() : base("name = sqlite")
        {

        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Project>().ToTable("Programmer").HasKey(p => p.Id);
            //modelBuilder.Entity<ProjectManager>().ToTable("ProjectManager").HasKey(p => p.ID);
            Database.SetInitializer(new SqliteCreateDatabaseIfNotExists<SqliteDbContext>(modelBuilder));
        }

        public virtual DbSet<Project> Programmers { get; set; }

    }
}
